﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace ShootMan
{
    public sealed class GuideStepChangeImage : shaco.Base.GuideStepDefault
    {
        /// <summary>
        /// 图片对象名字
        /// </summary>
        [SerializeField]
        private shaco.GuideRuntimeObject<UnityEngine.UI.Image> _imageTarget = null;

        /// <summary>
        /// 图片精灵
        /// </summary>
        [SerializeField]
        private shaco.GuideResourceObject<Sprite> _spriteTarget = null;

        [SerializeField]
        [Header("等待x秒修改背景图")]
        public float waitTime = 1f;

        /// <summary>
        /// 新手引导执行逻辑
        /// </summary>
        override public IEnumerator Execute()
        {
            yield return new WaitForSeconds(waitTime);
            _spriteTarget.GetValue((sprite) =>
            {
                _imageTarget.value.sprite = sprite;
            });
        }

        /// <summary>
        /// 新手引导执行完毕逻辑
        /// </summary>
        override public void End()
        {
        }
    }
}